package com.piggy.logi.sys.api;

import com.piggy.common.core.constant.SecurityConstants;
import com.piggy.common.core.constant.ServiceNameConstants;
import com.piggy.common.core.domain.R;
import com.piggy.common.core.web.page.TableDataInfo;
import com.piggy.logi.sys.api.bo.LogiSysDeptExtCusEditBo;
import com.piggy.logi.sys.api.domain.LogiSysDept;
import com.piggy.logi.sys.api.factory.RemoteLogiDeptFallbackFactory;
import com.piggy.logi.sys.api.vo.LogiSysDeptExtVo;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 用户服务
 *
 * @author shark
 */
@FeignClient(contextId = "remoteLogiDeptService", value = ServiceNameConstants.SYSTEM_LOGI_SERVICE, fallbackFactory = RemoteLogiDeptFallbackFactory.class)
public interface RemoteLogiDeptService {

    @GetMapping("/logi/dept/getById")
    R<LogiSysDeptExtVo> getById(@RequestParam("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 通过用户名查询用户信息
     *
     * @param source 请求来源
     * @return 结果
     */
    @GetMapping("/logi/dept/getOrgDeptId/{deptId}")
    Long getOrgDeptId(@PathVariable("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    /**
     * 通过用户名查询用户信息
     *
     * @param source 请求来源
     * @return 结果
     */
    @GetMapping("/logi/dept/{deptId}")
    R<LogiSysDeptExtVo> getInfo(@PathVariable("deptId") Long deptId, @RequestHeader("temp") String source);

    @PostMapping("/logi/dept/queryDeptAll")
    R<List<LogiSysDeptExtVo>> queryDeptAll(@RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/logi/dept/saveSysDept")
    R<LogiSysDeptExtVo> saveSysDept(@RequestBody LogiSysDept logiSysDept, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/logi/{clientId}")
    R<LogiSysDeptExtVo> detailInfo(@PathVariable("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/logi/dept/bossAdd")
    R<LogiSysDeptExtVo> bossAdd(@Validated @RequestBody LogiSysDeptExtCusEditBo dept1, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/logi/dept/bossEdit")
    R<LogiSysDeptExtVo> bossEdit(@Validated @RequestBody LogiSysDeptExtCusEditBo dept1, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @PostMapping("/logi/dept/rootList")
    TableDataInfo<LogiSysDeptExtVo> rootList(@RequestBody LogiSysDept dept, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

    @DeleteMapping("/logi/dept/root/{deptId}")
    R removeRoot(@PathVariable("deptId") Long deptId, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);

}
